package kuzha;

import java.io.PrintStream;
import java.util.ArrayList;
import java.util.List;

public class ErrorReport {
	private final List<ErrorMessage> msgs = new ArrayList<ErrorMessage>();
	
	public void addMessage(String filename, SourceLocation location, String message) {
		addMessage(new ErrorMessage(filename, location, message));
	}
	
	public void addMessage(ErrorMessage msg) {
		msgs.add(msg);
	}
	
	public void addAll(ErrorReport report) {
		msgs.addAll(report.msgs);
	}
	
	public boolean hasFatalError() {
		return msgs.size() != 0;	// TODO
	}
	
	public void printReport(PrintStream ps) {
		for(ErrorMessage msg: msgs) {
			ps.println(msg);
		}
	}
}
